package com.AEWMS.Servlet;

import com.AEWMS.Service.AdminService;
import com.alibaba.fastjson.JSON;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ths
 * @create 2021/3/31 22:35
 */
@WebServlet(name = "RemoveClassAdminServlet", urlPatterns = "/RemoveClassAdminServlet")
public class RemoveClassAdminServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String  AdminStudentNumber = request.getParameter("p1");
        String studentNumber = request.getParameter("p2");
        AdminService as = new AdminService();
        if(as.deleteAdmById(AdminStudentNumber)){
            response.getWriter().println(JSON.toJSONString("取消成功"));
            return;
        }else{
            response.getWriter().println(JSON.toJSONString("取消失败"));
        }
        as.closeCon();
    }
}
